#include <stdio.h>

int main(){
    char *filename = "test2.txt";
    FILE *myFile = fopen(filename,"a+");
    if(myFile == NULL){
        printf("文件打开失败\r\n");
    }else{
        printf("文件打开成功\r\n");
    }
    //向文件中写入一个字符
    int result = fputc(97,myFile);
    if(result==EOF){
        printf("向文件中写入字符失败\r\n");
    }else{
        printf("向文件中写入字符成功\r\n");
    }
    result = fclose(myFile);
    if(result!=0){
        printf("文件关闭失败%d\r\n",result);
    }else{
        printf("文件关闭成功%d\r\n",result);
    }
    return 0;

}